import { AccessToken } from "livekit-server-sdk";
import { LIVEKIT_API_KEY, LIVEKIT_API_SECRET } from "../utils/config.js";
// 创建token
export const createToken = async ({ roomName, participantName }) => {
  const at = new AccessToken(LIVEKIT_API_KEY, LIVEKIT_API_SECRET, {
    identity: participantName,
    // token to expire after 10 minutes
    ttl: "10m",
  });
  at.addGrant({ roomJoin: true, room: roomName });
  return await at.toJwt();
};
